<script type="text/javascript">
var companies = <?php echo Zend_Json::encode($this->key_companies);?>;
$(document).ready(function(){
	$( "#product_group_code" ).change(function(){
		var tmp=$(this);
		$.ajax({
		   type: "POST",
		   url: "<?php echo $this->url(array("controller"=>"inbound-detail","action"=>"ajax-load-product","module"=>"inbound"),null,true)?>",
		   data: {"product_product_group_code":tmp.val(),"product_code":$('#inbound_detail_product_code').val()},			   
		   success: function(html){
		      $('#inbound_detail_product_code').html(html);
		   }
		 });
	});	
	$( "#inbound_company_code" ).blur(function(){
		if( companies[$(this).val()] == null ){
			$(this).val('');
		}
	});	
	$( "#inbound_create_time_a" ).datepicker({
		create : function (){
			
		},
		'onSelect' : function(){
				
		}
	});
	$( "#product_group_code" ).trigger('change');
});
</script>

<!-- thanh toolbar -->
<?php $act = (string)$this->inbound_type == '1' ? 'insert-out' : 'insert-in' ;?>
<?php $this->placeholder('toolbar')->captureStart();?>
<?php echo $this->partial('index/toolbar/excel.phtml', 'admin') ?>
<?php echo $this->partial('index/toolbar/excel-all.phtml', 'admin') ?>
<?php echo $this->partial('index/toolbar/divider.phtml', 'admin') ?>
<?php echo $this->partial('index/toolbar/new.phtml', 'admin', array($this->url(array('action' => $act)))) ?>
<?php //echo $this->partial('index/toolbar/edit.phtml', 'admin', array($this->url(array('action' => 'update')))) ?>
<?php //echo $this->partial('index/toolbar/divider.phtml', 'admin') ?>
<?php //echo $this->partial('index/toolbar/trash.phtml', 'admin', array($this->url(array('action' => 'delete')))) ?>
<?php $this->placeholder('toolbar')->captureEnd();?>
<!-- / -->

<!-- submenu -->
<?php /*$this->submenu=array(
"Danh sách phiếu {$this->string_inbound_type} kho"=>$this->url(array("report_type"=>0)),
"Tra cứu thông tin {$this->string_inbound_type} kho"=>$this->url(array("report_type"=>1)),
"Báo cáo {$this->string_inbound_type} kho"=>$this->url(array("report_type"=>2)),
);*/?>
<!-- / -->

<form id='adminForm' name='adminForm' method='post' action=''>
	<dl class="zend_form">

	<!-- phần tìm kiếm -->	
	<div class='formSearh'>
	<fieldset>
		<legend>Thông tin tìm kiếm</legend>
		<?php echo $this->form->adminAction;?>
		<?php echo $this->form->inbound_code;?>
		<?php echo $this->form->inbound_create_time_a;?>
		<?php echo $this->form->inbound_create_time_b;?>
		<?php echo $this->form->inbound_create_user;?>
		
		<?php if(($this->report_type==1||$this->report_type==2)&&$this->inbound_type==1&&($this->inbound_warehouse_group_code=='BB' || $this->inbound_warehouse_group_code=='NVL')){?>
		<?php echo $this->form->inbound_detail_sub_product_code	;?>
		<?php }?>
		
		<?php if($this->report_type==1||$this->report_type==2){?>		
		<?php //echo $this->form->product_group_code;?>
		<?php echo $this->form->inbound_detail_product_code;?>
		<?php }?>
		
		<?php //echo $this->form->inbound_warehouse_code;?>
		<?php //echo $this->form->inbound_reason_code;?>
		<?php if($this->inbound_type==1){?>
		<?php echo $this->form->inbound_company_code;?>
		<?php }?>
	</fieldset>
	</div>
	<!-- / -->
	
	<!-- danh sách hiển thị -->
	<div class='clr'> </div>
	<table class='adminlist'>
		<?php echo $this->partial("report-type-{$this->report_type}.phtml",'inbound', array('paginator'=>$this->paginator,'captions'=>$this->captions,'string_inbound_type_2'=>$this->string_inbound_type_2,'inbound_type'=>$this->inbound_type))?>		
		<tfoot>
			<tr>
				<td colspan='16'>
					<div class='container'>
						<?php echo $this->paginationControl($this->paginator) ?>
					</div>
				</td>
			</tr>
		</tfoot>
	</table>
	<!-- / -->
	
	</dl>
</form>
